package com.heima.mapper;

import com.heima.pojo.VmType;
import com.heima.pojo.dto.PartnerQueryParamDto;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface VmTypeMapper {
     List<VmType> selectVmList(PartnerQueryParamDto vmDto) ;
    @Select("select name from tb_vm_type where name = #{name} or model = #{model} ;")
    String selectVmListByModelAndName(VmType vmType);
    @Insert("INSERT INTO  tb_vm_type (type_id, vm_row, vm_col, name, channel_max_capacity, model, image) " +
            "values (#{typeId},#{vmRow},#{vmCol},#{name},#{channelMaxCapacity},#{model},#{image})")
    void addVmType(VmType vmType);
    @Update("update tb_vm_type  set vm_row=#{vmRow},vm_col=#{vmCol},name=#{name},channel_max_capacity=#{channelMaxCapacity},model=#{model},image=#{image} where type_id =#{typeId};")
    void updateVmType(VmType vmType);
    @Delete("delete from tb_vm_type  where type_Id = #{typeId}")
    void deleteVmType(int typeId);
    @Select("select count(*) from tb_vending_machine where vm_type = #{typeId}")
    int selectVendingMachineBytypeId(int typeId);
}
